/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.CompanyInfo;
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.MessageManager;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.sql.SQLException;
/*    */ import java.util.ArrayList;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ import javax.servlet.RequestDispatcher;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class ShowWhiteBoard extends AbstractAction
/*    */ {
/* 26 */   private int id = 0;
/*    */ 
/* 28 */   private static Logger logger = Logger.getLogger(ShowPeople.class.getName());
/*    */ 
/*    */   public ShowWhiteBoard(AbstractHttpServlet servlet) {
/* 31 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public ShowWhiteBoard(AbstractHttpServlet servlet, String id) {
/* 35 */     super(servlet);
/* 36 */     this.id = Util.str2Int(id);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 43 */     MessageManager manager = new MessageManager();
/*    */     try {
/* 45 */       Map item = manager.getDetail(this.id);
/*    */ 
/* 48 */       User u = super.getLoginUser(request);
/* 49 */       int updateNum = manager.updateViewStatus(this.id, u.userId);
/* 50 */       if (updateNum == 0) {
/* 51 */         request.getRequestDispatcher("/errorpage.jsp").forward(request, 
/* 52 */           response);
/* 53 */         return;
/*    */       }
/*    */ 
/* 56 */       List readedUsers = manager.getReadedUser(this.id);
/* 57 */       List users = new ArrayList();
/* 58 */       CompanyInfo company = super.getCompany(request);
/* 59 */       for (Object readedUserO : readedUsers) {
                    Map readedUser = (Map)readedUserO;
/* 60 */         String userId = (String)readedUser.get("ReceiveUserId");
/* 61 */         User readU = company.getUser(userId);
/* 62 */         if (readU != null)
/*    */         {
/* 65 */           users.add(readU);
/*    */         }
/*    */       }
/* 68 */       request.setAttribute("item", item);
/* 69 */       request.setAttribute("readUsers", users);
/* 70 */       request.getRequestDispatcher("/whiteboard_detail.jsp").forward(
/* 71 */         request, response);
/*    */     } catch (SQLException e) {
/* 73 */       logger.warn(e);
/*    */     }
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.ShowWhiteBoard
 * JD-Core Version:    0.6.1
 */